Page({
  data: {
    cateItems: [
      {
        cate_id: 1,
        cate_name: "手机",
        ishaveChild:true,
        children: [
          {
            child_id: 1,
            image: "/packageC/fl1/phone/mi.png",
            url: "/packageC/fl1/fl1"
          },
          {
            child_id: 2,
            image: "/packageC/fl1/phone/iphone.png",
            url: "/packageC/fl1/fl10"
          },
          {
            child_id: 3,
            image: "/packageC/fl1/phone/huawei.png",
            url: "/packageC/fl1/fl11"
          },
          {
            child_id: 4,
            image: "/packageC/fl1/phone/oneplus.png",
            url: "/packageC/fl1/fl12"
          },
          {
            child_id: 5,
            image: "/packageC/fl1/phone/meizu.png"
          },
          {
            child_id: 6,
            image: "/packageC/fl1/phone/vivo.png"
          },
          {
            child_id:7,
            image: "/packageC/fl1/phone/oppo.png"
          },
          {
            child_id: 8,
            image: "/packageC/fl1/phone/honor.png"
          },
          {
            child_id: 9,
            image: "/packageC/fl1/phone/realme.png"
          }
        ]
      },
      {
        cate_id: 2,
        cate_name: "数码影音",
        ishaveChild: true,
        children: [
          {
            child_id: 1,
            name: '耳机',
            image: "/packageC/fl1/phone/erji.jpg",
            url: "/packageC/fl2/fl2"
          },
          {
            child_id: 2,
            name: '音响',
            image: "/packageC/fl1/phone/yingxiang.jpg",
            url: "/packageC/fl2/fl21"
          },
          {
            child_id: 3,
            name: '摄像机',
            image: "/packageC/fl1/phone/xiangji.jpg"
          }
          ,
          {
            child_id: 3,
            name: '智能手表',
            image: "/packageC/fl1/phone/shoubiao.jpg"
          }
        ]
      },
      {
        cate_id: 3,
        cate_name: "电脑办公",
        ishaveChild: true,
        children: [
          {
            child_id: 1,
            name: '游戏本',
            image: "/packageC/fl1/phone/youxiben.jpg",
            url: "/packageC/fl3/fl3"
          },
          {
            child_id: 2,
            name: '高性能笔记本',
            image: "/packageC/fl1/phone/bijiben.jpg",
            url: "/packageC/fl3/fl31"
          },
          {
            child_id: 3,
            name: '机械键盘',
            image: "/packageC/fl1/phone/jianpan.jpg"
          },
          {
            child_id: 4,
            name: '鼠标',
            image: "/packageC/fl1/phone/shubiao.jpg"
          },
          {
            child_id: 5,
            name: '台式机',
            image: "/packageC/fl1/phone/taishiji.jpg"
          },
          {
            child_id: 6,
            name: '打印机',
            image: "/packageC/fl1/phone/dayingji.jpg"
          },
          {
            child_id: 7,
            name: '显示器',
            image: "/packageC/fl1/phone/xianshiqi.jpg"
          }
        ]
      },
      {
        cate_id: 4,
        cate_name: "男装",
        ishaveChild: true,
        children: [
          {
            child_id: 1,
            name: '衬衫',
            image: "/packageC/fl1/phone/chenshan.jpg",
            url: "/packageC/fl4/fl4"
          },
          {
            child_id: 2,
            name: '卫衣',
            image: "/packageC/fl1/phone/weiyi.jpg",
            url: "/packageC/fl4/fl41"
          },
          {
            child_id: 3,
            name: '卫裤',
            image: "/packageC/fl1/phone/weiku.jpg"
          },
          {
            child_id: 4,
            name: '休闲裤',
            image: "/packageC/fl1/phone/xiuxianku.jpg"
          },
          {
            child_id: 5,
            name: '工装裤',
            image: "/packageC/fl1/phone/gongzhuangku.jpg"
          }
        ]
      },
      {
        cate_id: 5,
        cate_name: "箱包",
        ishaveChild: true,
        children: [
          {
            child_id: 1,
            name: '行李箱',
            image: "/packageC/fl1/phone/xinglixiang.jpg"
          },
          {
            child_id: 2,
            name: '双肩包',
            image: "/packageC/fl1/phone/shuangjianbao.jpg"
          },
          {
            child_id: 3,
            name: '手提包',
            image: "/packageC/fl1/phone/shoutibao.jpg"
          },
          {
            child_id: 4,
            name: '斜挎包',
            image: "/packageC/fl1/phone/xiekuabao.jpg"
          }
        ]
      },
      {
        cate_id: 6,
        cate_name: "个护清洁",
        ishaveChild: true,
        children: [
          {
            child_id: 1,
            name: '卷纸',
            image: "/packageC/fl1/phone/juanzhi.jpg"
          },
          {
            child_id: 2,
            name: '洗发水',
            image: "/packageC/fl1/phone/xifashui.jpg"
          },
          {
            child_id: 3,
            name: '男士洗发水',
            image: "/packageC/fl1/phone/nanshi.jpg"
          },
          {
            child_id: 4,
            name: '护发素',
            image: "/packageC/fl1/phone/hufasu.jpg"
          },
          {
            child_id: 5,
            name: '牙刷',
            image: "/packageC/fl1/phone/yashua.jpg"
          },
          {
            child_id: 6,
            name: '牙膏',
            image: "/packageC/fl1/phone/yagao.jpg"
          }
          
        ]
      }
    ],
     curIndex: 0,
     curNav: 1
  },

  // 切换右侧栏显示内容
  switchRightTab: function (e) {
    let id = e.currentTarget.dataset.id;
    let index = parseInt(e.currentTarget.dataset.index);
    this.setData({
      curNav: id,
      curIndex: index
    });
  },

  // 处理子项点击事件，跳转到对应页面
  onItemTap: function (e) {
    const url = e.currentTarget.dataset.url;
    wx.navigateTo({
      url: url
    });
  }
});

